<template>
  <view class="run-group-page">
    <image class="img" mode="widthFix" :src="state.imgUrl"></image>
    <view class="header-box">
      <view class="header" :style="{paddingTop: (useAppData.titleHeight+3) + 'px'}">
        <view class="back-box" style="left: 0;" @tap="gotoBack">
          <image class="back-img" src="../../static/icon-back.png"></image>
        </view>
        <span>活动说明</span>
      </view>
    </view>
  </view>
</template>

<script setup>
import { onLaunch, onShow, onHide, onUnload,onPullDownRefresh, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
import { ref, reactive, onMounted, watch } from "vue"
import * as API from "../../api/api"
import { getTime } from "../../utils/util"
import { storeToRefs } from "pinia";
import { useRunInfoStore } from "../../store/runInfo";
import { useAppStore } from "../../store/app";
import { useShareStore } from "../../store/share";
import { useGroupStore } from "../../store/group"
const useGroupData = useGroupStore();
const useShareData = useShareStore()
const useAppData = useAppStore()
const useRunInfoData = useRunInfoStore()
import headerBgImg from '../../static/bg@2x_compressed.png'
import {getConfigList} from "../../api/api";
const { showPictureUpload } = storeToRefs(useRunInfoData)
const { safeBottom } = storeToRefs(useAppStore)
const transferPopup = ref(null)
const alertDialog = ref(null)
const uploadAvatar = ref(null)
const state = reactive({
  list: [
    {
      name: '大奖1',
      item: []
    }
  ],
  imgUrl: null,
  show: false,
  activePrize: '',
  activeTime: '',
  first: {
    configDesc: "",
    configKey: "",
    configValue: "",
    createBy: null,
    createTime: "",
    lockVersion: null,
    orderNo: 0,
    pageNum: null,
    pageSize: null,
    parentUuid: "",
    subConfigs: [],
    updateBy: null,
    updateTime: null,
    uuid: "",
  },
  second: {
    configDesc: "",
    configKey: "",
    configValue: "",
    createBy: null,
    createTime: "",
    lockVersion: null,
    orderNo: 0,
    pageNum: null,
    pageSize: null,
    parentUuid: "",
    subConfigs: [],
    updateBy: null,
    updateTime: null,
    uuid: "",
  },
  three: {
    configDesc: "",
    configKey: "",
    configValue: "",
    createBy: null,
    createTime: "",
    lockVersion: null,
    orderNo: 0,
    pageNum: null,
    pageSize: null,
    parentUuid: "",
    subConfigs: [],
    updateBy: null,
    updateTime: null,
    uuid: "",
  },
  youth: {
    configDesc: "",
    configKey: "",
    configValue: "",
    createBy: null,
    createTime: "",
    lockVersion: null,
    orderNo: 0,
    pageNum: null,
    pageSize: null,
    parentUuid: "",
    subConfigs: [],
    updateBy: null,
    updateTime: null,
    uuid: "",
  },
  userInfo: null,
  barWidth: '30%',
  dialogType: 1,
  showEditPicture: false,
})

onShareAppMessage((res) => {
  return useShareData.shareInfo
})
onShareTimeline((res) => {
  return useShareData.shareInfo
})

const gotoBack = () => {
  uni.navigateBack()
}

// 获取页面数据
const getGroupInfo = () => {
  let query = useGroupData?.groupType == 1 ? "family_run_group_prize_desc_img" : "super_run_group_prize_desc_img"
  getConfigList({
    configKeys: [query]
  }).then(res => {
    if (res.code === 0) {
      state.imgUrl = res.data[0]?.configValue
    }
  }).finally(() => {
  })
}

onShow(() => {
  state.userInfo = uni.getStorageSync("userInfo") ? JSON.parse(uni.getStorageSync("userInfo")) : null
  getGroupInfo()
})
</script>

<style lang="scss" scoped>
.run-group-page{
  width: 100vw;
  //height: calc(100vh - 88rpx);
  padding-bottom: constant(safe-area-inset-bottom); /*兼容 IOS<11.2*/
  padding-bottom: env(safe-area-inset-bottom); /*兼容 IOS>11.2*/
  background-size: cover;
  overflow: hidden;
  .img{
    width: 100vw;
    position: absolute;
    left: 0;
    top: 0;
  }
  .header-box{
    position: relative;
    width: 100vw;
    text-align: center;
    .title{
      font-size: 34rpx;
      color: #000000;
    }
    .header-bg{
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      z-index: -1;
    }
    .update-btn{
      width: 170rpx;
      height: 60rpx;
      margin: 0 auto;
      background: rgba(0,0,0,0.3);
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 60rpx;
      margin-top: 12px;
      .label{
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 24rpx;
        color: rgba(255,255,255,0.7);
        line-height: 34rpx;
        text-align: center;
        font-style: normal;
      }
      .icon{
        width: 28rpx;
        height: 28rpx;
      }
    }
  }
}
</style>
